package cn.iocoder.yudao.module.member.dal.mysql.studentShow;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.studentShow.vo.StudentShowExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.studentShow.vo.StudentShowPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.studentShow.StudentShowDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 学生风采 Mapper
 *
 * @author 谭万全
 */
@Mapper
public interface StudentShowMapper extends BaseMapperX<StudentShowDO> {

    default PageResult<StudentShowDO> selectPage(StudentShowPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentShowDO>()
                .likeIfPresent(StudentShowDO::getTitle, reqVO.getTitle())
                .eqIfPresent(StudentShowDO::getImageUrl, reqVO.getImageUrl())
                .eqIfPresent(StudentShowDO::getStatus, reqVO.getStatus())
                .eqIfPresent(StudentShowDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(StudentShowDO::getContext, reqVO.getContext())
                .eqIfPresent(StudentShowDO::getUpdater, reqVO.getUpdater())
                .likeIfPresent(StudentShowDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(StudentShowDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(StudentShowDO::getId));
    }

    default List<StudentShowDO> selectList(StudentShowExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StudentShowDO>()
                .eqIfPresent(StudentShowDO::getTitle, reqVO.getTitle())
                .eqIfPresent(StudentShowDO::getImageUrl, reqVO.getImageUrl())
                .eqIfPresent(StudentShowDO::getStatus, reqVO.getStatus())
                .eqIfPresent(StudentShowDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(StudentShowDO::getContext, reqVO.getContext())
                .betweenIfPresent(StudentShowDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(StudentShowDO::getId));
    }
    List<StudentShowDO> recoveryStudentShowPage(IPage page, @Param("request") Map<String, Object> request );

    void updateBatchRecoveryStudentShow(@Param("ids") List<Long> ids);
}
